#include "lynx.h"

int jfc_login(char *user_name, char *user_password, char *user_ip,
	int time_length, char *jsjinfo, char *client_ver)
{
	return 0;
}

int jfc_logout(char *user_name, char *user_passwd, char *user_ip)
{
	return 0;
}

int jfc_addtime(char *user_name, char *user_passwd, char *user_ip, int addtime_length)
{
	return 0;
}

int chpasswd(char *user_name, char *old_passwd, char *new_passwd, char *user_ip)
{
	return 0;
}

int jfc_ustate(char *user_name, char *user_ip)
{
	return 0;
}

int jfc_isonline(char *user_name)
{
	return 0;
}

int jfc_blsj(void)
{
	return printf("TODO: %s", __func__);
}

int jfc_jfbz(void)
{
	return printf("TODO: %s", __func__);
}

int jfc_udpserver(void)
{
	return printf("TODO: %s", __func__);
}

/* main proc */
void lynx(void)
{
	int ret = jfc_login(NULL, NULL, NULL,
			0, NULL, NULL);
	int t = 0;
	
	while (1) {
		if(ret == 0) {
			sleep(300);
			t += 300;
			if(t > 3300) {
				ret = jfc_addtime(NULL, NULL, NULL, 0);
				if(ret == 0) {
					t -= 3300;
					continue;
				}
				else {
					printf("addtime fail\n");
					break;
				}
			}
			ret = jfc_ustate(NULL, NULL);

			if(ret == 0)
				continue;
			else {
				printf("ustate fail\n");
				break;
			}
		} else {
			printf("Authenticate fail\n");
			break;
		}

		sleep(1);
	}
}
